﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
using HtmlAgilityPack;
namespace DocFile_HTML
{
    class Program
    {
        static void Main(string[] args)
        {
            StreamReader rd = new StreamReader(args [0]);
            if (rd != null)
            {
                String chuoi = rd.ReadLine();
                HtmlWeb hw = new HtmlWeb();
                HtmlAgilityPack.HtmlDocument hd = hw.Load(chuoi);
                HtmlNode hn = hd.DocumentNode;
                HtmlNodeCollection anode = hd.DocumentNode.SelectNodes("//span[@class='title']");
              
               if (anode.Count() > 0)
               {
                   StreamWriter wt = new StreamWriter(args[1], false, Encoding.Unicode);
                   wt.WriteLine(anode.Count());//So dong tieu de
                   foreach (HtmlNode hnode in anode)
                   {
                       wt.WriteLine(hnode.InnerText);//Tieu de dong 
                   }
                   wt.Close();
               }
                
            }
        }
    }
}

